package pers.cz.logtail.handler;

import java.util.Queue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.LinkedBlockingQueue;

/**
 * @program: JefLogTail
 * @description:阻塞队列
 * @author: Cheng Zhi
 * @create: 2023-03-24 12:53
 **/
public class FileLineNodeQueue {

    //private static Queue<Object> queue = new ConcurrentLinkedQueue<Object>();
    private static LinkedBlockingQueue<Object> queue = new LinkedBlockingQueue<Object>();

    public static void push(Object o) {
        queue.add(o);
    }

    /**
     * 获取并移除头部元素
     */
    public static Object take() throws InterruptedException {
        Object take = queue.take();
        return take;
    }


}
